# module for read and query
# CH 3/18/2010

import csv

zipcodes = [] # global (to module/file)

#print "blabla"

def read_data(fname):
    """ read in fname as .csv file and return a list of zip codes"""
    csvReader = csv.reader(open(fname)) # delimiters are commas   
    count = 0
    for r in csvReader:  # zip code are in the 2. column
        if count > 0:
            #print r[1]
            zipcodes.append(r[1]) # skip first (header) line
        count += 1 # need to count
    pass  # so i can set a breakpoint here
    #print count, zipcodes

def query_by_zip_code(zip_code):
    if zip_code in zipcodes:
        return True
    return False
